//
//  UIImgaeViewExtension.swift
//  BookStore
//
//  Created by JinYuXin on 2022/5/11.
//

import Foundation
import UIKit

extension UIImageView
{
    func downloadAsyncFrom(url:String)
    {
        let urlNet = URL(string: url)
        let task = URLSession.shared.dataTask(with: urlNet!)
        {
            
            (data,response,error) in
            if let nsd = data{
                DispatchQueue.main.async {
                    self.image = UIImage(data: nsd, scale: 1)
                    self.contentMode = .scaleAspectFit
                }
            }
        }
        task.resume()
    }
}
